﻿<html>
<head>
    <script type="text/javascript">
        function loadXMLDoc() {
            var xmlhttp;
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
                }
            }
            xmlhttp.open("GET", "/ajax/demo_get.asp", true);
            xmlhttp.send();
        }

        function WinOpen() {
            msg = open("", "DisplayWindow", "toolbar=no,directories=no,menubar=no,height=150,width=300,top=400,left=400");
            msg.document.write("<HEAD><TITLE>哈 罗!</TITLE></HEAD>");
            msg.document.write("<CENTER><H1>酷 毙 了!</H1><h2>这 是<B>JavaScript</B>所 开 的 视 窗!</h2></CENTER>");
        }
        function ShowLocation(ImgD, imageWidth, imageHeight, color) {
            var mDiv = document.getElementById('locationDiv');

            mDiv.style.display = 'block';
            mDiv.style.top = 200;
            mDiv.style.left = 200;
            mDiv.style.borderWidth = 1 + 'px';
            mDiv.style.borderColor = color;
            mDiv.style.borderStyle = 'solid';
            mDiv.style.width = imageWidth + 'px';
            mDiv.style.height = imageHeight + 'px';
        }
        function HideLocation() {
            var mDiv = document.getElementById('locationDiv');
            mDiv.style.display = 'none';
        }
        
    </script>
    <style type="text/css">
        #closePic
        {
            text-align: justify;
        }
    </style>
</head>
<body>
    <h2>
        AJAX</h2>
    <button type="button" onclick="loadXMLDoc()">
        请求数据</button>
    <div id="myDiv">
        This is a simple HTML- page.
        <br>
        <br>
        最后修改时间:
        <script language="LiveScript">
  <!--  hide script from old browsers
    document.write(document.lastModified)
  // end hiding contents -->
        </script>
        <br>
        <br>
        <script language="LiveScript">
<!--            Hiding
            today = new Date()
            
            document.write("现 在 时 间 是： ", today.getHours(), ":", today.getMinutes(), ":", today.getSeconds())
            document.write("<br>今 天 日 期 为： ", today.getMonth() + 1, "/", today.getDate(), "/", today.getYear());
// end hiding contents -->
        </script>
        <br>
        <br>
        <input type="button" name="Button1" value="Push me" onclick="WinOpen()">
        <br>
        <br>
        <input type="button" name="Button2" value="弹出DIV" onclick="ShowLocation('/_layouts/VoteList/Images/EastMap.png',400,400,'#8db4e2');">
    </div>
    <br>
    <br>
    <div id="locationDiv" style="display: none; position: absolute; background-color: White">
        <div style="text-align: center;">
            <input type="button" value="点击关闭" id="closePic" onclick="HideLocation()" />
            
        </div>
    </div>
</body>
</html>
